var request = require('request'),
	cheerio = require('cheerio'),
	baseUrl = 'https://au.finance.yahoo.com/q/ao?s={0}',
	ticker = process.argv[2],
	url = baseUrl.replace('{0}', ticker);

request(url, function(err, resp, body) {
	var $ = cheerio.load(body),
		opinion = {
			Current: $($('.yfnc_tabledata1').get(0)).text(),
			PriceTarget: parseFloat($($('.yfnc_tabledata1').get(3)).text()),
			OpinionsCount: parseInt($($('.yfnc_tabledata1').get(7)).text())
		},
		opinions = [opinion],
		opinionsString = JSON.stringify(opinions);
	
	console.log(opinionsString);
});